<template>
  <div v-if="boxTitle" :class="boxTitle ? 'four-container' : ''">
    <div v-if="boxTitle" class="fourBorder border1 light"></div>
    <div v-if="boxTitle" class="fourBorder border2 light"></div>

    <div v-if="boxTitle" class="fourBorder border3 light"></div>
    <div v-if="boxTitle" class="fourBorder border4 light"></div>
    <slot></slot>
  </div>
  <div class="item" v-else>
    <div>
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "fourAngel",
  props: {
    boxTitle: {
      type: String,
      default: "",
    },
  },
};
</script>

<style lang="scss" scoped>
.four-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  background: rgba(75, 139, 247, 0.05);
  box-shadow: 1px 1px 16px #7ccef4 inset;
  // .fourBorder {
  //   position: absolute;
  //   width: 10px;
  //   height: 1px;
  // }

  .border1 {
    left: -1px;
    top: -1px;
    border-left: 1px solid #7bc6e9;
    border-top: 1px solid #7bc6e9;
  }

  .border2 {
    right: -1px;
    top: -1px;
    border-right: 1px solid #7bc6e9;
    border-top: 1px solid #7bc6e9;
  }

  // .border3 {
  //   left: -1px;
  //   bottom: -1px;
  //   border-left: 1px solid #7bc6e9;
  //   border-bottom: 1px solid #7bc6e9;
  // }

  // .border4 {
  //   right: -1px;
  //   bottom: -1px;
  //   border-right: 1px solid #7bc6e9;
  //   border-bottom: 1px solid #7bc6e9;
  // }
  // .login_form {position: absolute;}// 自定义盒子宽高
  .light {
    position: absolute;
    display: block;
  }
  .light:nth-child(1) {
    filter: hue-rotate(0deg);
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #7bc6e9);
    animation: animate1 8s linear infinite;
  }

  @keyframes animate1 {
    0% {
      left: -100%;
    }

    50%,
    100% {
      left: 100%;
    }
  }
  .light:nth-child(2) {
    filter: hue-rotate(60deg);
    top: -100%;
    right: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, transparent, #3a86ff);
    animation: animate2 8s linear infinite;
    animation-delay: 2s;
  }

  @keyframes animate2 {
    0% {
      top: -100%;
    }

    50%,
    100% {
      top: 100%;
    }
  }
  .light:nth-child(3) {
    filter: hue-rotate(120deg);
    bottom: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(270deg, transparent, yellow);
    animation: animate3 8s linear infinite;
    animation-delay: 4s;
  }

  @keyframes animate3 {
    0% {
      right: -100%;
      height: 3px;
    }

    50%,
    100% {
      height: 2px;
      right: 100%;
    }
  }
  .light:nth-child(4) {
    filter: hue-rotate(300deg);
    bottom: -100%;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(360deg, transparent, #79acff);
    animation: animate4 8s linear infinite;
    animation-delay: 6s;
  }

  @keyframes animate4 {
    0% {
      bottom: -100%;
    }

    50%,
    100% {
      bottom: 100%;
    }
  }
}
@keyframes opacityChange {
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}
@keyframes rotate {
  100% {
    transform: rotate(1turn);
  }
}
.item {
  width: 100%;
  height: 100%;
  --bRadius: 5px;
  div {
    position: relative;
    width: calc(100% - 10px);
    height: calc(100% - 20px);
    // width: calc(100% -20px);
    // height: calc(100% -20px);
    text-align: center;
    font-size: 24px;
    border-radius: var(--bRadius);
    transition: all 0.3s;
    &::before,
    &::after {
      content: "";
      position: absolute;
      width: 100%;
      height: 100%;
      right: -10px;
      bottom: -10px;
      border: 3px solid #52ffff;
      transition: all 0.5s;
      border-radius: var(--bRadius);
      -webkit-animation: clippath-fd2e4944 3s infinite linear;
      animation: clippath-fd2e4944 3s infinite linear;
    }
    &::after {
      animation: clippath 3s infinite -1.5s linear;
    }
    @keyframes clippath {
      0%,
      100% {
        clip-path: inset(0 0 98% 0);
      }
      25% {
        clip-path: inset(0 98% 0 0);
      }
      50% {
        clip-path: inset(98% 0 0 0);
      }
      75% {
        clip-path: inset(0 0 0 98%);
      }
    }
  }
}
</style>
